function [x, shrinked] = Shrink_colours(x)
% [x, shrinked] = Shrink_colours(x)
% 
% Shrink_colours takes an image and projects the colours onto [0 255].
% The second output is the ratio of indices where projection is performed.
%
% 2013-07-25 --------------------------------------------------------------
% 
% Matthias J. Ehrhardt
% CMIC, University College London, UK
% 
% matthias.ehrhardt.11@ucl.ac.uk
% 
% -------------------------------------------------------------------------
    
    M1 = find(x<0);
    M2 = find(x>255);
    
    shrinked = (length(M1) + length(M2)) / length(x);

    x(M1) = 0;
    x(M2) = 255;
end